home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Human Interface Toolbox / Calculator / CalcController.h < prev    next >
Encoding:
Text File  |  2000-10-06  |  1.6 KB  |  62 lines

  1. /*
  2.     File:       CalcController.h
  3.  
  4.     Contains:   xxx
  5.  
  6.     Written by: Andy Wildenberg
  7.  
  8.     Created:    Wed 09-Jul-1997
  9.  
  10.     Copyright:  (c)1997 by Apple Computer, Inc., all rights reserved.
  11.  
  12.     Change History (most recent first):
  13.                 7/5/00    KG    Updated for Project Builder on DP4
  14.  
  15.     You may incorporate this sample code into your applications without
  16.     restriction, though the sample code has been provided "AS IS" and the
  17.     responsibility for its operation is 100% yours.  However, what you are
  18.     not permitted to do is to redistribute the source as "DSC Sample Code"
  19.     after having made changes. If you're going to re-distribute the source,
  20.     we require that you make it clear in the source that the code was
  21.     descended from Apple Sample Code, but that you've made changes.
  22. */
  23.  
  24. #import <AppKit/AppKit.h>
  25.  
  26. // operation consts
  27.  
  28. enum {kNoOperator, kAddOperator, kSubtractOperator, kMultiplyOperator, kDivideOperator};
  29.  
  30. @interface CalcController : NSObject
  31. {
  32.     id displayView;
  33.     BOOL enteringNumber;
  34.     BOOL usedDecimalPoint;
  35.     NSDecimalNumber* displayedNumber;
  36.     NSDecimalNumber* enteredNumber;
  37.     SEL nextOperation;
  38.     int lastOperation;
  39. }
  40.  
  41. - (void)operation:(id)sender;
  42. - (void)clear:(id)sender;
  43. - (void)equals:(id)sender;
  44. - (void)insertDigit:(id)sender;
  45.  
  46. // pasteboard commands
  47. - (void)cut:(id)sender;
  48. - (void)copy:(id)sender;
  49. - (void)paste:(id)sender;
  50.  
  51. // internal commands
  52. - (void)beginEditingNumber;
  53. - (void)endEditingNumber;
  54. - (void)decimalPoint:(id)sender;
  55. - (void)awakeFromNib;
  56. - (void)performLastOperation;
  57. - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
  58.  
  59. // cleanup commands
  60. -(void)dealloc;
  61. @end
  62.